import sys
from PyQt5.QtWidgets import QApplication, QWidget, QGridLayout, QLabel 
from PyQt5.QtGui import QPixmap
import sys
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
import SimpleITK as sitk
import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
import cv2 



if __name__ == '__main__':
    labelImage = sitk.ReadImage("/media/chyang/data/dataset/project/hipbone/nnUNet_raw/Dataset001_PelvicNAS/imagesTr/1.3.6.1.4.1.9328.50.4.0001_0000.nii.gz") #in_file是nii.gz文件的路径
    img = sitk.GetArrayFromImage(labelImage)
    img_scaled = (img - img.min()) / (img.max() - img.min()) * 255
    img_scaled = img_scaled.astype(np.uint8)

    
    # z = 0
    # slice = img_scaled[:, :, 200]
    # plt.imshow(slice)
    # plt.show()
    # print("eee")
    
    # cv2.imshow( "22",img_scaled[:, :, 200])
    # cv2.waitKey(0)
    
    
    
    